// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 账号密码登录 POST /authorize/login */
export async function loginByAccountPassword(
  body: Record<string, any>,
  options?: { [key: string]: any },
) {
  return request<API.UserToken>('/authorize/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 退出登录 DELETE /authorize/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<number>('/authorize/logout', {
    method: 'DELETE',
    ...(options || {}),
  });
}

/** 获取用户信息 GET /authorize/me */
export async function me(options?: { [key: string]: any }) {
  return request<API.UserEntity>('/authorize/me', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 注册用户 POST /authorize/register */
export async function register(options?: { [key: string]: any }) {
  return request<boolean>('/authorize/register', {
    method: 'POST',
    ...(options || {}),
  });
}
